Skip to content

docs: Crusher circuit example#229

Open
toby-coleman wants to merge 11 commits intomainfrom
chore/crusher-circuit-example
Open

docs: Crusher circuit example#229
toby-coleman wants to merge 11 commits intomainfrom
chore/crusher-circuit-example

Conversation

@toby-coleman
Copy link
Contributor

Summary

Adds a simple model of a crusher circuit using a population balance model (PBM) approach. Includes recirculation to showcase Plugboard feedback loops.

Changes

  • Notebook for a crusher circuit.
  • Optimisation example [WIP]
  • Updated LLM prompts, including researcher agent for use with NotebookLM MCP server.

@github-actions
Copy link

Benchmark comparison for 64adfa9a (base) vs 6e910476 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.12-64bit/0001_base)     447.7165 (1.0)      457.0178 (1.0)      452.2852 (1.0)      3.9510 (1.0)      451.2083 (1.0)      6.7746 (2.13)          2;0  2.2110 (1.0)           5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.12-64bit/0001_pr)         462.4066 (1.03)     471.8064 (1.03)     464.7280 (1.03)     3.9888 (1.01)     463.1687 (1.03)     3.1747 (1.0)           1;1  2.1518 (0.97)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive example of a mineral processing crusher circuit simulation within the Plugboard framework. It demonstrates dynamic modeling using the Population Balance Model, incorporates a recirculation loop with transport delays, and includes parameter optimization capabilities. Concurrently, it updates the AI agent configurations to better support the development and documentation of such complex examples, enhancing the framework's utility for technical users.

Highlights

  • New Example: Crusher Circuit Simulation: Implemented a dynamic crusher circuit simulation using the Population Balance Model (PBM) approach, showcasing complex physical process modeling within Plugboard.
  • Recirculation Loop Demonstration: Demonstrated Plugboard's feedback loop capabilities with a recirculation circuit that includes a transport delay, illustrating realistic transient dynamics.
  • AI Agent Enhancements: Introduced new AI agent definitions for 'examples' and 'researcher' roles, and updated existing 'docs' and 'lint' agent configurations to specify LLM models, improving automated development support.
Changelog
  • .github/agents/docs.agent.md
    • Added a 'model' field to the agent configuration.
  • .github/agents/examples.agent.md
    • Added a new agent definition for developing Plugboard examples and tutorials.
  • .github/agents/lint.agent.md
    • Added a 'model' field to the agent configuration.
  • .github/agents/researcher.agent.md
    • Added a new agent definition for researching topics related to Plugboard.
  • examples/AGENTS.md
    • Refactored the document to focus on general Plugboard model creation guidelines.
    • Removed specific example categories and Jupyter Notebook guidelines.
  • examples/demos/physics-models/002-crusher-circuit/.gitignore
    • Added a new gitignore file to exclude CSV output.
  • examples/demos/physics-models/002-crusher-circuit/_test_dynamics.py
    • Added a new Python script to test the crusher circuit simulation.
  • examples/demos/physics-models/002-crusher-circuit/crusher_circuit.ipynb
    • Added a new Jupyter Notebook demonstrating the crusher circuit simulation, including PBM background, component definitions, simulation run, visualization, and parameter optimization.
  • examples/demos/physics-models/002-crusher-circuit/crusher_circuit.py
    • Added a new Python module containing the PSD data model and Plugboard components (FeedSource, Crusher, Screen, Conveyor, ProductCollector) for the crusher circuit.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an excellent, comprehensive example of a crusher circuit simulation, which effectively showcases Plugboard's capabilities for physics-based modeling. The addition of the Jupyter notebook, Python components, and a test script is well-executed. The PR also includes valuable refactoring and additions to the AI agent definitions. I've identified a few potential runtime issues in the new Python code related to error handling and defensive programming. My specific comments provide suggestions to enhance the robustness of the simulation code. These changes should be applied to both the .py module and the corresponding Jupyter notebook. Overall, this is a strong contribution.

@github-actions
Copy link

Benchmark comparison for 4ada5719 (base) vs 5a429f13 (PR)


------------------------------------------------------------------------------------------------------------------- benchmark: 2 tests ------------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean             StdDev              Median                IQR            Outliers     OPS            Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.12-64bit/0001_pr)         443.0621 (1.0)      487.6143 (1.05)     454.3728 (1.0)      19.0902 (5.41)     443.8869 (1.0)      18.5908 (3.18)          1;0  2.2008 (1.0)           5           1
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.12-64bit/0001_base)     454.5047 (1.03)     462.5164 (1.0)      458.0402 (1.01)      3.5256 (1.0)      456.1425 (1.03)      5.8455 (1.0)           2;0  2.1832 (0.99)          5           1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@github-actions
Copy link

Benchmark comparison for 4ada5719 (base) vs 46562443 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.12-64bit/0001_pr)         441.9077 (1.0)      448.1235 (1.0)      444.9032 (1.0)      2.3904 (1.0)      444.9548 (1.0)      3.5302 (1.0)           2;0  2.2477 (1.0)           5           1
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.12-64bit/0001_base)     450.7535 (1.02)     458.5529 (1.02)     453.5541 (1.02)     3.1448 (1.32)     453.4888 (1.02)     4.1866 (1.19)          1;0  2.2048 (0.98)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@github-actions
Copy link

Benchmark comparison for 4ada5719 (base) vs 52988272 (PR)


------------------------------------------------------------------------------------------------------------------- benchmark: 2 tests ------------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean             StdDev              Median                IQR            Outliers     OPS            Rounds  Iterations
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.12-64bit/0001_base)     451.7242 (1.0)      500.7858 (1.09)     479.2152 (1.05)     21.3488 (6.68)     480.6554 (1.05)     38.0270 (8.58)          2;0  2.0867 (0.96)          5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.12-64bit/0001_pr)         453.0459 (1.00)     460.8895 (1.0)      458.1553 (1.0)       3.1982 (1.0)      459.0638 (1.0)       4.4326 (1.0)           1;0  2.1827 (1.0)           5           1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@github-actions
Copy link

Benchmark comparison for 4ada5719 (base) vs 50a0205b (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.12-64bit/0001_base)     450.8995 (1.0)      457.7372 (1.0)      454.9723 (1.0)      2.9883 (1.0)      456.2108 (1.00)     5.0552 (1.0)           1;0  2.1979 (1.0)           5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.12-64bit/0001_pr)         451.7939 (1.00)     461.5936 (1.01)     455.8111 (1.00)     4.4123 (1.48)     454.2883 (1.0)      7.8532 (1.55)          1;0  2.1939 (1.00)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@toby-coleman toby-coleman marked this pull request as ready for review March 25, 2026 07:34
@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant